﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using InspectionDAL;

namespace InspectionPageFlow
{

    public sealed class CreationInspectionEnCours : NativeActivity
    {
        public InArgument<string> NomMecanicien { get; set; }

        protected override void Execute(NativeActivityContext context)
        {
            InspectionEnCours creation = new InspectionEnCours();
            creation.Mecanicien = context.GetValue(NomMecanicien);
            creation.IdWorkflow = context.WorkflowInstanceId;

            using (InspectionEntities dal = new InspectionEntities())
            {
                dal.InspectionEnCours.AddObject(creation);
                dal.SaveChanges();
            }
        }
    }
}
